x86/vlapic: fixes for HVM code when running without a vlapic
authorRoger Pau Monné <roger.pau@citrix.com>
Thu, 26 Nov 2015 15:00:56 +0000 (16:00 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 26 Nov 2015 15:00:56 +0000 (16:00 +0100)
commit302a8519fb8537f619569873d605f65eb18f4bdc
treea8a33c8ee49b136b017094b60f5fc4559a217d74
parent0ce647ad6f70c5ec0aeee66ce74429982b81911a
x86/vlapic: fixes for HVM code when running without a vlapic

The HVM related code (SVM, VMX) generally assumed that a local apic is
always present. With the introduction of a HVM mode were the local apic can
be removed, some of this broken code paths arised.

The SVM exit/resume paths unconditionally checked the state of the lapic,
which is wrong if it's been disabled by hardware, fix this by adding the
necessary checks. On the VMX side, make sure we don't add mappings for a
local apic if it's disabled.

In the generic vlapic code, add checks to prevent setting the TSC deadline
timer if the lapic is disabled, and also prevent trying to inject interrupts
from the PIC is the lapic is also disabled.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vlapic.c
xen/arch/x86/hvm/vmx/vmx.c